package pojo;

import java.io.Serializable;

import lombok.Data;

/**
 * S_C
 *
 * @author
 */
@Data
public class SC extends SCKey implements Serializable {
    private Student student;
    private Course course;
    private CourseGrade courseGrade;
    private Long coursegradeid;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SC other = (SC) that;
        return (this.getStudentid() == null ? other.getStudentid() == null : this.getStudentid().equals(other.getStudentid()))
                && (this.getCourseid() == null ? other.getCourseid() == null : this.getCourseid().equals(other.getCourseid()))
                && (this.getCoursegradeid() == null ? other.getCoursegradeid() == null : this.getCoursegradeid().equals(other.getCoursegradeid()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getStudentid() == null) ? 0 : getStudentid().hashCode());
        result = prime * result + ((getCourseid() == null) ? 0 : getCourseid().hashCode());
        result = prime * result + ((getCoursegradeid() == null) ? 0 : getCoursegradeid().hashCode());
        return result;
    }

    //    @Override
//    public String toString() {
//        StringBuilder sb = new StringBuilder();
//        sb.append(getClass().getSimpleName());
//        sb.append(" [");
//        sb.append("Hash = ").append(hashCode());
//        sb.append(", coursegradeid=").append(coursegradeid);
//        sb.append(", serialVersionUID=").append(serialVersionUID);
//        sb.append("]");
//        return sb.toString();
//    }
    @Override
    public String toString() {
        return "{" +
                "\"dailyWork\":\"" + courseGrade.getDailywork().toString() + '\"' +
                ",\"midExamResults\":\"" + courseGrade.getMidexamresults().toString() + '\"' +
                ", \"examResults\":\"" + courseGrade.getExamresults().toString() + '\"' +
                ", \"totalMark\":\"" + courseGrade.getExamresults().toString() + '\"' + '}';
    }
}